{$this->Html->script('pages/tra_cuu_sp', ['inline' => false])}
<div id="box3_1">
	<form class="tool_tracuu" action="{Router::url('/', true)}" method="get">
		<h1 class="h1tracuu">Tra cứu sản phẩm</h1>
		<a class="teninput">Mã sản phẩm</a>
		<input type="text" class="form-control input_tracuu" placeholder="Mã sản phẩm" name="ma_sp" value="{$thamsoForm['ma_sp']}">
		<a class="teninput">Tên sản phẩm</a>
		<input type="text" class="form-control input_tracuu" placeholder="Tên sản phẩm" name="ten_sp" value="{$thamsoForm['ten_sp']}">
		<a class="teninput">Giới tính</a>
		<select class="form-control input_tracuu" name="gioi_tinh">
			<option value="">Giới tính</option>
			{foreach $dsGioiTinh as $key => $value}
				<option value="{$key}" {$value['checked']}>{$value['value']}</option>
            {/foreach}
		</select>
		<a class="teninput">Chọn nhà sản xuất</a>
		<select class="form-control input_tracuu" name="id_nsx">
			<option value="">Nhà sản xuất</option>
			{foreach $dsNSX as $key => $value}
				<option value="{$key}" {$value['checked']}>{$value['value']}</option>
	        {/foreach}
		</select>
		<a class="teninput">Từ khóa</a>
		<input type="text" class="form-control input_tracuu" placeholder="Từ khóa" name="tu_khoa" value="{$thamsoForm['tu_khoa']}">
		
		<label class="tentt" for="co_bao_het_hang_">Tất cả</label>
		<input type="radio" name="co_bao_het_hang" id="co_bao_het_hang_" value="" checked>
		{foreach $dsTrangThaiHetHang as $key => $value}
			<label class="tentt" for="co_bao_het_hang_{$key}">{$value['value']}</label>
			<input type="radio" name="co_bao_het_hang" id="co_bao_het_hang_{$key}" value="{$key}" class="radio_tracuu" {$value['checked']}>
        {/foreach}
        
		<br>
		{foreach $dsTrangThai as $key => $value}
			<label class="tentt" for="trang_thai_{$key}">{$value['value']}</label>
			<input type="radio" name="trang_thai" id="trang_thai_{$key}" value="{$key}" {$value['checked']}>
        {/foreach}
		<br>
		<button type="submit" class="but but-default but-sm nut_tracuu">
			<span class="icon icon-search"></span> Tra cứu
		</button>
	</form>
	<div class="box_sp">
		<div class="box_sp1">
			{if $data|count > 0}
			{foreach $data as $sp}
				{if $sp['SanPhamModel']['co_bao_het_hang']}
				<div class="sp boxhethang">
				{else}
				<div class="sp">
				{/if}
					<img class="hinhsp" alt="" src="{Router::url('/', true)}files/uploaded/images/{$sp['SanPhamModel']['hinh_anh']}">
					<a href="#" class="tensp">{$sp['SanPhamModel']['ten_sp']}</a>
					<a href="#" class="tennsx">{$sp['NhaSanXuatModel']['ten_nsx']}</a>
					<div class="qlsp">
						<div class="ad_qlsp">
							<!--<a href="" class="label label-info">Chi tiết <span class="icon icon-file cachicon"></span></a>-->
							{if $quyen == "QLadmin"}
							<a href="{Router::url('/', true)}quan_tri/san_pham/chinh_sua?id_sp={$sp['SanPhamModel']['id_sp']}" class="label label-info">Chỉnh sửa <span class="icon icon-pencil cachicon"></span></a>
							<a onclick="xoaSP({$sp['SanPhamModel']['id_sp']})" class="label label-info">Xóa <span class="icon icon-remove cachicon"></span></a>
							{/if}
						</div>						
						{if $sp['SanPhamModel']['co_bao_het_hang']}
							<p class="label label-danger hethang">Tạm hết hàng <span class="icon icon-exclamation-sign cachicon"></span></p>
							{if $quyen == "QLhethang"}
							<a onclick="thayDoiTrangThaiHetHang({$sp['SanPhamModel']['id_sp']},0)" class="label label-success baohet_con">Báo còn hàng <span class="icon icon-pushpin cachicon"></span></a>
							{/if}
						{else}
							<p class="label label-success conhang">Còn hàng <span class="icon icon-thumbs-up cachicon"></span></p>
							{if $quyen == "QLhethang"}
							<a onclick="thayDoiTrangThaiHetHang({$sp['SanPhamModel']['id_sp']},1)" class="label label-danger baohet_con">Báo hết hàng <span class="icon icon-pushpin cachicon"></span></a>
							{/if}
						{/if}
					</div>
					<div class="cl"></div>
				</div>
			{/foreach}
			{else}
				<center><p class="required">Không tìm thấy sản phẩm cần tìm</p></center>
			{/if}
		</div>

		<div class="box_phantrang">
			
			<ul class="pagination pagination-sm">				
				{$this->Paginator->prev('«',['tag' => 'li'],null,['class' => 'prev disabled', 'disabledTag' => 'span', 'tag' => 'li'])}
				{$this->Paginator->numbers(['first' => 1, 'last' => 1, 'modulus' => 2, 'tag' => 'li', 'separator' => '', 
				'currentClass' => 'activept', 'currentTag' => 'span', 'ellipsis' => '<li><span>...</span></li>' ])}
				{$this->Paginator->next('»',['tag' => 'li'],null,['class' => 'next disabled', 'disabledTag' => 'span', 'tag' => 'li'])}				
			</ul>
		</div>
		<div class="cl"></div>
	</div>
	<div class="cl"></div>
	<div class="cr"></div>
</div>